const express = require('express')

const app = express()


//定义第一个局部中间件

const mw1 = (req, res, next) => {
    console.log('调用了局部中间件1')
    next()
}


//定义
const mw2 = (req, res, next) => {
    console.log('调用了局部中间件2')
    next()
}


app.get('/', [mw1, mw2], (req, res) => {
    res.send('home page.')
})

app.post('/user', (req, res) => {
    res.send('user page.')
})

app.listen(80, () => {
    console.log('express server running at http://127.0.0.1')
})